package bairui.international.console.web.controller.prize.nine;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.ModelAndView;

import com.lianjing.sh.project.config.web.Project_Config_Web_PageTemplate;
import com.lianjing.sh.spring.web.controller.base.action.Action;
import com.lianjing.sh.spring.web.controller.enhance.module.context.ModuleContext;
import com.lianjing.sh.spring.web.controller.enhance.navigations.context.NavigationContext;

import bairui.international.model.domain.jpa.TB_Prize;
import bairui.international.model.status.State_Prize;
import bairui.international.service.Service_Prize;

/**
 *
 * 详情
 *
 * @generated
 * 
 * @see STest_C_Prize_Nine_Detail_DetailAccess 测试
 *
 */
@Controller
public class C_Prize_Nine_Detail_DetailAccess
 extends SC_Prize_Nine_Detail_DetailAccess 
{
	
	@Autowired private Service_Prize service_Prize;
	
	/**
	 * 访问详情页面
	 */
	@Action(DetailAccess.class)
	@GetMapping(DetailAccess.RequestMappingValue)
	public ModelAndView detailAccess(
		ModelMap map, HttpServletRequest request,
		NavigationContext navigationContext, ModuleContext moduleContext, 
		@PathVariable(name=DetailAccess.PathVariableName.Id) long id
	) throws Exception {
		TB_Prize bean = service_Prize.findById(id);
		bean.setFileUrl(C_Prize_Nine_Manage_ShowImg.ShowImg.Operate(id).getUrl());
		State_Prize state_Prize = bean.getState();
		/* 模块 */
		moduleContext
			.addModule(module_Info.module(
					new Module_Info_OutputModel(bean),
					new C_Prize_Nine_Manage_Delete.Delete.Operate(){
						@Override public Object getId() { return id; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					}, 
					new C_Prize_Nine_Manage_Publish.Publish.Operate(){
						@Override public Object getId() { return id; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					}, 
					new C_Prize_Nine_Manage_Up.Up.Operate(){
						@Override public Object getId() { return id; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					}, 
					new C_Prize_Nine_Manage_Down.Down.Operate(){
						@Override public Object getId() { return id; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					}, 
					new C_Prize_Nine_Manage_EditAccess.EditAccess.Operate(){
						@Override public Object getId() { return id; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					},
					new C_Prize_Nine_Manage_Finish.Finish.Operate(){
						@Override public Object getId() { return id; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					}
				))
			.addModule(module_ItemPage.module(
					new C_Prize_Nine_Detail_ItemPage.ItemPage.Operate(){
						@Override public Object getId() { return id; }
					}, 
					new C_Prize_Nine_ItemManage_FileUpload.FileUpload.Operate(){
						@Override public Object getPrizeId() { return id; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					}, 
					new C_Prize_Nine_ItemManage_Delete.Delete.Operate(){
						@Override public Object getPrizeId() { return id; }
						@Override public Object getId() { return "{{:id}}"; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					}, 
					new C_Prize_Nine_ItemManage_EditAccess.EditAccess.Operate(){
						@Override public Object getPrizeId() { return id; }
						@Override public Object getId() { return "{{:id}}"; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					},
					new C_Prize_Nine_ItemManage_SetPrize.SetPrize.Operate(){
						@Override public Object getPrizeId() { return id; }
						@Override public Object getId() { return "{{:id}}"; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					},
					new C_Prize_Nine_ItemManage_SetNoPrize.SetNoPrize.Operate(){
						@Override public Object getPrizeId() { return id; }
						@Override public Object getId() { return "{{:id}}"; }
						@Override public bairui.international.model.status.State_Prize getState_Prize() { return state_Prize; }
					}
				))
			.addModule(module_UserPage.module(
					new C_Prize_Nine_Detail_UserPage.UserPage.Operate(){
						@Override public Object getId() { return id; }
					},
					new C_Prize_Nine_WinFinish_Submit.Submit.Operate(){
						@Override public Object getWinId() {
							return "{{:id}}";
						}
					}
				));
		//
		return Project_Config_Web_PageTemplate.Admin_Common(request);
	}
	

}
